# -*- coding:utf-8 -*-

"""
# StringIO操作
# BytesIO
    # file-like对象

"""

"""
# StringIO操作
# getvalues()获取全部内容

from io import StringIO
# 内存中构建
sio = StringIO()  #像文件对象一样操作。
print(sio.readable(),sio.writable(),sio.seekable())
sio.write('first\n program')
sio.seek(0)
print(sio.readline())
print(sio.getvalue()) #无视指针,输出全部内容.
sio.close()

# BytesIO
from io import BytesIO  # 内存中构建
bio = BytesIO()
print(bio.readable(),bio.writable(),bio.seekable())
bio.write(b"firstoney\n learning py")
bio.seek(0)
print(bio.readline())
print(bio.getvalue()) # 无视指针,输出全部内容.
bio.close()

# file-like对象
from sys import stdout
f = stdout
print(type(f))
print(f.write('first one program'))
"""